<template>
  <div id="app">
    <router-view/>
  </div>
</template>
<script>
export default {
  dada() {
    return {};
  },
  created() {
    this.isPhone();
  },
  mounted(){
    window.addEventListener('resize',()=>{this.isPhone()} )
  //   document.querySelector('body').addEventListener('touchstart', function (event) {
  //        event.stopPropagation();
  // });
    //  // 阻止双击放大
    // var lastTouchEnd = 0;
    // document.addEventListener('touchstart', function(event) {
    //     if (event.touches.length > 1) {
    //         event.preventDefault();
    //     }
    // });
    // document.addEventListener('touchend', function(event) {
    //     var now = (new Date()).getTime();
    //     if (now - lastTouchEnd <= 300) {
    //         event.preventDefault();
    //     }
    //     lastTouchEnd = now;
    // }, false);
 
    // // 阻止双指放大
    // document.addEventListener('gesturestart', function(event) {
    //     event.preventDefault();
    // });
  },
  methods: {
    isPhone() {
      let flag = navigator.userAgent.match(
        /(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i
      );
      if (flag) {
        if (this.$route.path != "/phone") {
          this.$router.push("/phone");
        }
        
      } else {
        if (this.$route.path != "/pc") {
        this.$router.push("/pc");
        }
      }
    }
  }
};
</script>
<style lang="less" scoped>
#app {
  background: rgba(237, 237, 237, 0.3);
  position: absolute;
  top: 0;
  bottom: 0;
  width: 100%;
  overflow: auto;
  height: 100%;
  // background: #bfa;
}
</style>

